{include file="public/nheader"}
<style type="text/css">
    #lay-tableList {
        height: auto;
    }
</style>
<style type="text/css">
    .layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
        height: auto;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input value="{:input('get.created')}" name="created" lay-datetime=""
                                data-format="yyyy-MM-dd" data-type="date" class="layui-input" type="text"
                                placeholder="导入日期" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="copyid" lay-verify="">
                                <option value="">计划名称</option>
                                {foreach $copylist as $pp}
                                <option value="{$pp.id}" {if !empty(input('get.copyid')) &&
                                    input('get.copyid')==$pp.id}selected{/if}>{$pp.name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <!-- <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="youxiao" lay-verify="">
                                <option value="">有效状态</option>
                                <option value="0" {if empty(input('get.youxiao')) ||
                                    input('get.youxiao')==0}selected{/if}>未知待标记</option>
                                <option value="1" {if !empty(input('get.youxiao')) &&
                                    input('get.youxiao')==1}selected{/if}>有效</option>
                                <option value="2" {if !empty(input('get.youxiao')) &&
                                    input('get.youxiao')==2}selected{/if}>无效</option>
                            </select>
                        </div>
                    </div> -->
                    <!-- <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="channel" lay-verify="">
                                <option value="">来源</option>
                                {foreach $laiyuan as $pp}
                                <option value="{$pp}" {if !empty(input('get.channel')) &&
                                    input('get.channel')==$pp}selected{/if}>{$pp}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div> -->
                    <!-- <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="yxtags" lay-verify="">
                                <option value="">标签</option>
                                {foreach $yxtags as $pp}
                                <option value="{$pp}" {if !empty(input('get.yxtags')) &&
                                    input('get.yxtags')==$pp}selected{/if}>{$pp}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div> -->
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input name="title" class="layui-input" type="text" placeholder="手机号" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>搜索</button>
                        <button class="layui-btn icon-btn layui-btn-danger" lay-batch="lay-tableList"
                            data-url="/lista/excall_del">批量删除
                        </button>
                        <!-- <button class="layui-btn icon-btn layui-btn-danger" lay-batch="lay-tableList" data-url="/">批量删除
                        </button> -->
                    </div>
                </div>
            </div>
        </div>

        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <a class="layui-table-text" style="color:#FF5722" data-url="/lista/excall_del?id={{d.id}}" data-reload="self" data-confirm="" lay-ajax="">删除</a>
</script>
{include file="public/nfooter"}
<script>
    layui.use(['admin', 'layer', 'table', 'form', 'upload'], function () {
        var admin = layui.admin;
        var layer = layui.layer;
        var table = layui.table;      // 表格
        var form = layui.form;
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#excels' //绑定元素
            , accept: 'file'
            , url: '/admin/import_phone' //上传接口
            , before: function (obj) { //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
                layer.load(); //上传loading
            }
            , done: function (res) {
                layer.closeAll('loading'); //关闭loading
                //如果上传失败
                if (res.status == 0) {
                    var str = '';
                    $.each(res.data, function (i, obj) {
                        console.log(i, obj);
                        str += '<div>' + obj + '</div>';
                    });
                    layer.open({
                        type: 0,
                        content: str,
                        yes: function () {
                            location.reload();
                        }
                    });
                    return false;
                } else {
                    layer.msg(res.msg, { icon: 2, time: 1000 });
                    return false;
                }
            }
            , error: function () {
                layer.closeAll('loading'); //关闭loading
                layer.msg('请求失败请重试', { icon: 2, time: 1000 });
                return false;

            }
        });
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , where: {
                //created: "{:input('created',date('Y-m-d'))}",
            }
            , toolbar: 'true'
            // , defaultToolbar: ["filter","exports","print"]
            , defaultToolbar: [{
                title: '导出excel' //标题
                , layEvent: 'LAYTABLE_EXPORT' //事件名，用于 toolbar 事件中使用
                , icon: 'layui-icon-export' //图标类名
            }, {
                title: '打印页面' //标题
                , layEvent: 'LAYTABLE_PRINT' //事件名，用于 toolbar 事件中使用
                , icon: 'layui-icon-print' //图标类名
            }, {
                title: '筛选数据' //标题
                , layEvent: 'LAYTABLE_COLS' //事件名，用于 toolbar 事件中使用
                , icon: 'layui-icon-cols' //图标类名
            }]
            , even: true
            , loading: true
            , limits: [10, 20, 40, 60, 80, 100, 150, 200, 300, 100000]
            , limit: 10
            , cols: [[
                { type: 'checkbox', width: 60 },
                { field: 'id', align: 'center', sort: true, title: 'ID', width: 80 },
                { field: 'copy_name', width: 150, align: 'center', title: '计划名称' },
                { field: 'daorutime', width: 150, align: 'center', title: '导入日期' },
                // { field: 'ispinpai', width: 150, align: 'center', title: '导入品牌' },
                { field: 'phone', width: 150, align: 'center', title: '手机号' },
                // {
                //     field: 'province', width: 230, align: 'center', title: '号码归属地', templet: function (d) {
                //         return d.province + ' ' + d.city;
                //     }
                // },
                // {
                //     field: 'youxiao', width: 230, align: 'center', title: '标记状态', templet: function (d) {
                //         if (d.youxiao == 1) {
                //             return '<a class="layui-table-text"  style="color:#1890ff">有效</a>';
                //         }
                //         if (d.youxiao == 2) {
                //             return '<a class="layui-table-text" style="color:#FF5722">无效</a>';
                //         }
                //         return '未知';
                //     }
                // },
                // {
                //     field: 'lypinpai', width: 230, align: 'center', title: '数据来源'
                // },
                // {
                //     field: 'nnpinpai', width: 230, align: 'center', title: '资源来源'
                // },
                // {
                //     field: 'createTime', width: 230, align: 'center', title: 'ec创建时间'
                // },
                // {
                //     field: 'channel', width: 230, align: 'center', title: 'ec来源'
                // },
                // {
                //     field: 'yxtags', width: 230, align: 'yxtags', title: 'ec标签'
                // },

                // {
                //     field: 'pinpai', width: 230, align: 'center', title: '已推送品牌'
                // },
                // { field: 'created', width: 230, align: 'center', title: '导入时间' },
                { field: 'name', toolbar: '#tableBar', width: 200, align: 'center', title: '操作' },
            ]]
        })
    })
</script>